home *** CD-ROM | disk | FTP | other *** search
/ Internet Surfer: Getting Started / Internet Surfer - Getting Started (Wayzata Technology)(7231)(1995).bin / pc / mac / bonus / peter_le / finger-1 / my_units / mytransl.uni < prev    next >
Text File  |  1992-02-24  |  1KB  |  49 lines

  1. unit MyTranslate82728;
  2.  
  3. { This code is part of the Finger/Fingerd source code, written in THINK Pascal 4 }
  4. { Copyright 1991-1992 Peter N Lewis }
  5. { If you use this code, you must give me credit in your about box and documentation }
  6. { This is part of my generic library of routines }
  7.  
  8. interface
  9.  
  10.     const
  11.         translateResType = 'taBL';
  12.         translateOutResID = 128;
  13.         translateInresID = 129;
  14.  
  15.     type
  16.         transTable = array[0..255] of signedByte;
  17.  
  18.     procedure GetTrans (id: integer; var trans: transTable);
  19.  
  20. implementation
  21.  
  22.     uses
  23.         MyPreferences;
  24.  
  25.     procedure GetTrans (id: integer; var trans: transTable);
  26.         var
  27.             th: handle;
  28.             s: str255;
  29.             tfs: FSSpec;
  30.             tres, i: integer;
  31.     begin
  32.         GetPrefsFSSpec(tfs);
  33.         tres := HOpenResFile(tfs.vRefNum, tfs.parID, 'Translate 7<->8', fsRdPerm);
  34.         th := GetResource(translateResType, id);
  35.         if th = nil then
  36.             for i := 0 to 255 do
  37. {$PUSH}
  38. {$R-}
  39.                 trans[i] := i
  40. {$POP}
  41.         else begin
  42.             BlockMove(th^, @trans, SizeOf(trans));
  43.             ReleaseResource(th);
  44.         end;
  45.         if tres <> -1 then
  46.             CloseResFile(tres);
  47.     end;
  48.  
  49. end.